package com.blq.system.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blq.common.annotation.DataColumn;
import com.blq.common.annotation.DataPermission;
import com.blq.common.core.domain.entity.SysDept;
import com.blq.common.core.domain.entity.SysUser;
import com.blq.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 部门管理 数据层
 *
 * @author Blq
 */
public interface SysDeptMapper extends BaseMapperPlus<SysDeptMapper, SysDept, SysDept> {

//    @DataPermission({
//            @DataColumn(key = "deptName", value = "d.dept_id"),
//            @DataColumn(key = "userName", value = "u.user_id")
//    })
     Page<SysDept> selectPageDeptList(@Param("page") Page<SysUser> page,
                                      @Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper);

    /**
     * 查询部门管理数据
     *
     * @param queryWrapper 查询条件
     * @return 部门信息集合
     */
    @DataPermission({
        @DataColumn(key = "deptName", value = "dept_id")
    })
    List<SysDept> selectDeptList(@Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper);

    /**
     * 根据角色ID查询部门树信息
     *
     * @param roleId            角色ID
     * @param deptCheckStrictly 部门树选择项是否关联显示
     * @return 选中部门列表
     */
    List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
    //查所有子部门
    List<SysDept> selectListDept(@Param("deptId") String deptId, @Param("deptType") String deptType);


    SysDept selectone(String s);

    List<SysDept> selectServiceList(@Param("deptId") String deptId, @Param("city") String city, @Param("area") String area);
}
